package com.winchain.chainbill.bill.base.po;

import com.winchain.chainbill.constant.BillConstants;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

@Table(name = "cb_dct_qt")
public class CbDctQt {
	@Id
	@Column(name = "qt_id")
	private String qtId;
	@Column(name = "grp_id")
	private String grpId;
	@Column(name = "fin_id")
	private String finId;
	@Column(name = "fin_nm")
	private String finNm;
	@Column(name = "set_id")
	private String setId;
	@Column(name = "set_nm")
	private String setNm;
	@Column(name = "fin_type")
	private String finType;
	@Column(name = "qt_amt")
	private BigDecimal qtAmt;
	@Column(name = "qt_blk")
	private BigDecimal qtBlk;
	@Column(name = "qt_used")
	private BigDecimal qtUsed;
	@Column(name = "exp_date")
	private String expDate;
	@Column(name = "qt_state")
	private String qtState;
	@Column(name = "create_time")
	private String createTime;
	@Transient
	private BigDecimal availAmt;

	public String getQtId() {
		return this.qtId;
	}

	public void setQtId(String qtId) {
		this.qtId = qtId;
	}

	public String getFinId() {
		return this.finId;
	}

	public void setFinId(String finId) {
		this.finId = finId;
	}

	public String getFinType() {
		return this.finType;
	}

	public void setFinType(String finType) {
		this.finType = finType;
	}

	public String getSetId() {
		return this.setId;
	}

	public void setSetId(String setId) {
		this.setId = setId;
	}

	public String getSetNm() {
		return this.setNm;
	}

	public void setSetNm(String setNm) {
		this.setNm = setNm;
	}

	public BigDecimal getQtAmt() {
		return this.qtAmt;
	}

	public void setQtAmt(BigDecimal qtAmt) {
		this.qtAmt = qtAmt;
	}

	public BigDecimal getQtBlk() {
		return this.qtBlk;
	}

	public void setQtBlk(BigDecimal qtBlk) {
		this.qtBlk = qtBlk;
	}

	public BigDecimal getQtUsed() {
		return this.qtUsed;
	}

	public void setQtUsed(BigDecimal qtUsed) {
		this.qtUsed = qtUsed;
	}

	public String getExpDate() {
		return this.expDate;
	}

	public void setExpDate(String expDate) {
		this.expDate = expDate;
	}

	public String getQtState() {
		return this.qtState;
	}

	public void setQtState(String qtState) {
		this.qtState = qtState;
	}

	public String getGrpId() {
		return this.grpId;
	}

	public void setGrpId(String grpId) {
		this.grpId = grpId;
	}

	public String getFinNm() {
		return this.finNm;
	}

	public void setFinNm(String finNm) {
		this.finNm = finNm;
	}

	public String getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public BigDecimal getAvailAmt() {
		if (getQtAmt() == null) {
			this.availAmt = null;
		} else if (getQtAmt().compareTo(BillConstants.QT_AMT_NO_LIMIT) == 0) {
			this.availAmt = BillConstants.QT_AMT_NO_LIMIT;
		} else {
			this.availAmt = getQtAmt().subtract(getQtUsed()).subtract(getQtBlk());
		}
		return this.availAmt;
	}
}
